/**
 * 报表设计公司(2011)
 */
package com.reportgear.designer.action.style;

import java.util.EventObject;

import net.abbp.report.view.GridView;

import com.reportgear.core.swing.pane.base.JBaseDialog;
import net.abbp.swing.util.ImageUtils;
import com.reportgear.designer.action.StyleAction;
import com.reportgear.designer.pane.style.GlobalStyleDialog;

/**
 * 全局样式设置
 * 
 * @version 1.0 2011-3-24
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ANNCSR 2.0
 */
public class GlobalStyleAction extends StyleAction {

	public GlobalStyleAction() {
		setName("单元格样式");
		setMnemonic('S');
		setSmallIcon(ImageUtils.readIcon("format/global.png"));
	}

	@Override
	public boolean executeAction(EventObject evt) {
	    GridView gridView = this.getGridView();

		if (gridView == null) {
			return false;
		}

		GlobalStyleDialog dlg = new GlobalStyleDialog();

		dlg.populateCellStyle(gridView);
		dlg.showModel();

		if (dlg.getReturnValue() == JBaseDialog.RESULT_OK) {
			dlg.updateCellStyle(gridView);
			
			gridView.updateUI();
			return true;
		}

		return false;
	}

}
